package zyb.myproject;

import java.io.Serializable;

//用户
public class Client implements Serializable {

	private String username;
	private int password;
	private String name;
	private int age;

	public Client(String username) {
		this.username = username;
	}

	public Client() {
	}

	public Client(String username, int password) {
		super();
		this.username = username;
		this.password = password;
	}

	public Client(String username, int password, String name, int age) {
		super();
		this.username = username;
		this.password = password;
		this.name = name;
		this.age = age;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getPassword() {
		return password;
	}

	public void setPassword(int password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + password;
		result = prime * result + ((username == null) ? 0 : username.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Client other = (Client) obj;
		if (age != other.age)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (password != other.password)
			return false;
		if (username == null) {
			if (other.username != null)
				return false;
		} else if (!username.equals(other.username))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "用户信息： [用户账号：" + username + ", 用户密码：" + password + ", 用户名字：" + name + ", 用户年龄：" + age + "]";
	}

}
